<!-- 重构：与homt.html相似度较高 -->
{% extends '_base.html' %}

{% block active_home %} btn-primary {% endblock %}

{% block content %}
<form method="post">
    <div class="row">
        <div class="col-2">
            {% if user.avatar %}
                <img src="{{ url_for('getfile', filename=user.avatar) }}" class="img-fluid rounded-circle" alt="头像">
            {% else %} 
                <img src="{{ avatars.default() }}" class="img-fluid rounded-circle" alt="头像">
            {% endif %}
        </div>
        <div class="col">
            {% if user %}
                <h2>{{ user.name }} <small class="text-success">LV{{ level }}</small></h2>
                <h3>{{ user.exp }} 
                    <small><small>总经验
                        <small> (下一级还需：{{ need_exp }})</small>
                    </small></small>
                </h3>
            {% else %}
                <p>未登录</p>
            {% endif %} 
        </div>
    </div>
    <hr>
    {{ form.csrf_token }}
    <p>用户名：{{ form.username }}</p>
    <p>个人简介：{{ form.introduce }}</p>
    <p>邮箱：{{ form.email }}</p>
    {{ form.submit(class='btn btn-primary') }}
    <a class="btn btn-secondary btn-right" href="{{ url_for('auth.home') }}" role="button">取消</a>
</form>
{% endblock %}